/*
 * Copyright (c) 2013 Andaily Information Technology Co. Ltd
 * www.andaily.com
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Andaily Information Technology Co. Ltd ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you
 * entered into with Andaily Information Technology Co. Ltd.
 */
package cn.com.doone.common.uc.service;

import java.util.List;
import java.util.Map;

import org.apache.oltu.oauth2.common.exception.OAuthSystemException;

import cn.com.doone.common.uc.domain.oauth.AccessToken;
import cn.com.doone.common.uc.domain.oauth.ClientDetails;

/**
 * 2015/7/8
 *
 * @author Shengzhao Li
 */

public interface OAuthRSService {

    AccessToken loadAccessTokenByTokenId(String tokenId);

    ClientDetails loadClientDetails(String clientId, String resourceIds);
    
    public Map<String, Object> getUserInfo(String username);
    
    public void uploadHeadPortrait(String username, String headPortraitName);
    
    /**
     * 更新用户信息
     * @param map
     * @throws Exception
     */
    @SuppressWarnings("rawtypes")
	public void updateUserInfo(Map map) throws Exception;
    
    /**
     * 更新用户扩展信息
     * @param paramsMap
     */
    public Map<String, Object> updateUserExpandInfo(Map<String,Object> paramsMap);
    
    public String genInfoCode(AccessToken accessToken) throws Exception;
    
    public Map<String, Object> getUserInfoByCode(String infoCode, String appCode, String clientId) throws Exception;
    
    /**
     * 根据client_id获取用户绑定信息
     * 
     * @param clientId
     * @param appCode
     * @return
     */
    public List<Map<String, Object>> findWechatIdList(String clientId, String clientSecret, String appCode);
    
    /**
     * 根据用户ID获取第三方应用ID
     * 
     * @param userInfoId
     * @param appCode
     * @return
     */
    public Map<String, Object> findWechatIdByUserInfoId(int userInfoId, String appCode);
    
    
    /**
     * 根据token查询信息
     * @author cjf
     * @param paramsMap
     * @return
     */
	public Map<String, Object> queryInfoByToken(Map<String, Object> paramsMap);

	/**
	 * 生成code
	 * @author cjf
	 * @param paramsMap
	 * @return
	 * @throws OAuthSystemException
	 */
	public String createCode(Map<String, Object> paramsMap) throws OAuthSystemException;
	
	/**
	 * 根据手机号生成token
	 * @param paramsMap
	 * @return
	 * @throws OAuthSystemException 
	 */
	public Map<String,Object> createTokenByPhone(Map<String,Object> paramsMap) throws OAuthSystemException;
	
	/**
	 * 根据已有token生成其他应用token
	 * @param paramsMap
	 * @return
	 * @throws Exception
	 */
	public Map<String,Object> createTokenByToken(Map<String,Object> paramsMap) throws Exception;
	
	/**
	 * 根据账号生成token
	 * @param paramsMap
	 * @return
	 * @throws OAuthSystemException 
	 */
	public Map<String,Object> createTokenByAccount(Map<String,Object> paramsMap) throws OAuthSystemException;

}